import React, { Component } from "react";
import PropTypes from "prop-types";

export default class HeaderClassChild extends Component {
  static propTypes = {
    count: PropTypes.number,
    changeCount: PropTypes.func.isRequired,
  };

  static defaultProps = {
    count: 100,
  };
  render() {
    let { count, changeCount } = this.props;
    return (
      <div>
        <h1>HeaderClassChild:类组件</h1>
        <div>count:{count}</div>
        <p>
          <button onClick={() => changeCount(2)}>
            子组件改变父组件的state
          </button>
        </p>
      </div>
    );
  }
}
